package net.csdra.DongPoShuZiTuShuGuan.controller.video;

import net.csdra.DongPoShuZiTuShuGuan.domain.Video;
import net.csdra.DongPoShuZiTuShuGuan.service.VideoManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by add on 2018/1/17.
 */
@RestController
@RequestMapping("/api/videoManage")
public class VideoManageController {

    @Autowired
    VideoManagerService videoManagerService;

    @RequestMapping("/deleteVideo")
    public void deleteVideo(String id) {
        videoManagerService.deleteVideo(id);
    }

    @RequestMapping("/getAllVideoByEnable")
    public Page<Video> getAllVideoByEnable(@RequestBody VideoManagerService.GetAllVideoByEnable getAllVideoByEnable) {
        return videoManagerService.getAllVideoByEnable(getAllVideoByEnable);
    }

    @RequestMapping("/getVideo")
    public Video getVideo(@RequestBody VideoManagerService.GetVideo getVideo) {
        return videoManagerService.getVideo(getVideo);
    }


    @RequestMapping("/updateVideo")
    public Video updateVideo(@RequestBody VideoManagerService.UpdateVideo updateVideo) {
        return videoManagerService.updateVideo(updateVideo);
    }

    @RequestMapping("/createVideo")
    public Video createVideo(@RequestBody VideoManagerService.CreateVideo createVideo) {
        return videoManagerService.createVideo(createVideo);
    }

    @RequestMapping("/getAllVideo")
    public Page<Video> getAllVideo(@RequestBody VideoManagerService.GetAllVideo getAllVideo) {
        return videoManagerService.getAllVideo(getAllVideo);
    }
}
